<template>
  <view class="user-info">
    <uni-list>
      <uni-list-item title="用户名" :rightText="userInfo.username" />
      <uni-list-item title="邮箱" :rightText="userInfo.email" />
      <uni-list-item title="用户角色" :rightText="userInfo.is_admin ? '管理员' : '普通用户'" />
      <uni-list-item title="注册时间" :rightText="formatDate(userInfo.created_at)" />
    </uni-list>
  </view>
</template>

<script>
export default {
  data() {
    return {
      userInfo: uni.getStorageSync('userInfo') || {}
    }
  },
  
  methods: {
    formatDate(date) {
      return new Date(date).toLocaleString()
    }
  }
}
</script>

<style lang="scss">
.user-info {
  padding: 20rpx;
}
</style> 